package kr.nextree.spring.main;

import kr.nextree.spring.shop.Battery;
import kr.nextree.spring.shop.Disc;
import kr.nextree.spring.shop.Product;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class Main {
	public static void main(String[] args) {
		// ApplicationContext context = new ClassPathXmlApplicationContext(
		// "beans.xml");
		// SequenceGenerator generator = (SequenceGenerator) context
		// .getBean("sequenceGenerator");
		// System.out.println(generator.getSuquence());
		// System.out.println(generator.getSuquence());
		// testAbstractCallBean();
		testProductCreator();

	}

	private static void testAbstractCallBean() {
		ApplicationContext context = new ClassPathXmlApplicationContext(
				"product-beans.xml");
		Battery aaa = (Battery) context.getBean("aaa");
		Disc cdrw = (Disc) context.getBean("cdrw");

		System.out.println(aaa);

		System.out.println(cdrw);
	}

	private static void testProductCreator() {
		ApplicationContext context = new ClassPathXmlApplicationContext(
				"factory-product-beans.xml");

		Product aaa = (Product) context.getBean("aaa");
		Product cdrw = (Product) context.getBean("cdrw");

		System.out.println(aaa);
		System.out.println(cdrw);
	}
}
